home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / GMSV03B.lha / GamesMaster / Source / Asm / RasterEffects / Scroll&Mirror.s < prev    next >
Encoding:
Text File  |  1992-09-02  |  4.0 KB  |  159 lines

  1. ;WideScroll with mirror
  2. ;----------------------
  3. ;Mirror test for large width screens.
  4.  
  5.     opt    o+
  6.  
  7.     INCLUDE    "exec/exec_lib.i"
  8.     INCLUDE    "games/games_lib.i"
  9.     INCLUDE    "games/games.i
  10.  
  11. CALL    MACRO
  12.     jsr    _LVO\1(a6)
  13.     ENDM
  14.  
  15.     SECTION    "WideMirror",CODE
  16.  
  17. ;===========================================================================;
  18. ;                             INITIALISE DEMO
  19. ;===========================================================================;
  20.  
  21. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  22.     move.l    ($4).w,a6
  23.     lea    GMS_Name(pc),a1
  24.     moveq    #$00,d0
  25.     CALL    OpenLibrary
  26.     move.l    d0,GMS_Base
  27.     beq    Quit
  28.  
  29.     move.l    GMS_Base(pc),a6
  30.     CALL    SetUserPri
  31.  
  32.     move.l    GMS_Base(pc),a6          ;Tell GMS that we want to add a
  33.     lea    ScreenStruct(pc),a0      ;screen for use.
  34.     CALL    Add_Screen
  35.     tst.l    d0
  36.     bne    Error
  37.  
  38.     lea    Picture(pc),a1    ;a1 = Picture struct.
  39.     move.l    SS_MemPtr1(a0),PIC_Data(a1)
  40.     lea    PicFile(pc),a0    ;a0 = Picture file.
  41.     CALL    LoadPic    ;>> = Load the picture.
  42.     tst.w    d0
  43.     bne.s    ReturnToDOS
  44.  
  45.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  46.     CALL    Show_Screen
  47.  
  48.     moveq    #JPORT1,d0               ;Initialise the mouse port.
  49.     CALL    Read_Mouse
  50.  
  51. ;===========================================================================;
  52. ;                                MAIN LOOP
  53. ;===========================================================================;
  54.  
  55. Loop:    moveq    #JPORT1,d0               ;Port 1
  56.     CALL    Read_Mouse
  57.     btst    #MB_LMB,d0
  58.     bne.s    ReturnToDOS
  59.     move.w    d0,d1
  60.     asr.w    #8,d0
  61.     ext.w    d1
  62.     add.w    d0,SS_PicXOffset(a0)
  63.     add.w    d1,SS_PicYOffset(a0)
  64.  
  65. .chkty    tst.w    SS_PicYOffset(a0)
  66.     bge.s    .chkby
  67.     clr.w    SS_PicYOffset(a0)
  68.  
  69. .chkby    cmp.w    #255-190,SS_PicYOffset(a0)
  70.     blt.s    .chklx
  71.     move.w    #255-190,SS_PicYOffset(a0)
  72.  
  73. .chklx    tst.w    SS_PicXOffset(a0)
  74.     bge.s    .chkrx
  75.     clr.w    SS_PicXOffset(a0)
  76.  
  77. .chkrx    cmp.w    #16,SS_PicXOffset(a0)
  78.     ble.s    .move
  79.     move.w    #16,SS_PicXOffset(a0)
  80.  
  81. .move    CALL    Move_Picture
  82.     CALL    Wait_OSVBL
  83.     bra.s    Loop
  84.  
  85. ;===========================================================================;
  86. ;                              RETURN TO DOS
  87. ;===========================================================================;
  88.  
  89. ReturnToDOS:
  90.     move.l    GMS_Base(pc),a6
  91.     lea    ScreenStruct(pc),a0
  92.     CALL    Delete_Screen            ;Give back screen memory etc.
  93. Error:    move.l    GMS_Base(pc),a1
  94.     move.l    ($4).w,a6
  95.     CALL    CloseLibrary
  96. Quit:    MOVEM.L    (SP)+,A0-A6/D1-D7
  97.     moveq    #$00,d0
  98.     rts
  99.  
  100. ;===========================================================================;
  101. ;                                  DATA
  102. ;===========================================================================;
  103.  
  104. GMS_Name:
  105.     dc.b    "games.library",0
  106.     even
  107. GMS_Base:
  108.     dc.l    0
  109.  
  110. AMT_PLANES =    5
  111.  
  112. ScreenStruct:
  113.     dc.l    "GSV1",0
  114.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  115.     dc.l    0                        ;Screen link.
  116.     dc.l    Palette                  ;Address of palette.
  117.     dc.l    RasterList               ;Address of rasterlist.
  118.     dc.l    0                        ;Amt of colours in palette.
  119.     dc.w    320,256,336,256          ;Screen & Pic Height/Width.
  120.     dc.w    AMT_PLANES               ;Amt_Planes
  121.     dc.w    0,0                      ;X/Y screen offset.
  122.     dc.w    0,0                      ;X/Y picture offset.
  123.     dc.l    HSCROLL|VSCROLL          ;Special attributes.
  124.     dc.w    LORES                    ;Screen mode.
  125.     dc.b    INTERLEAVED              ;Screen type
  126.     dc.b    0                        ;Reserved.
  127.     even
  128.  
  129. RasterList:
  130.     WAITLINE 190
  131.     MIRROR
  132.     NEWPALETTE 0,32,WaterPalette
  133.     RASTEND
  134.  
  135. Palette    dc.w    $0000,$0130,$0FCB,$0FA9,$0D88,$0965,$0644,$0211
  136.     dc.w    $0400,$0444,$0FF0,$0432,$0CC0,$0150,$0501,$0880
  137.     dc.w    $0261,$0271,$0382,$0492,$05A3,$05B4,$0677,$06C4
  138.     dc.w    $0788,$09AA,$0BCC,$0801,$0901,$0A02,$0701,$0601
  139.  
  140. WaterPalette:
  141.     dc.w    $0000,$0010,$0765,$0754,$0644,$0432,$0322,$0100
  142.     dc.w    $0200,$0222,$0770,$0211,$0660,$0020,$0200,$0440
  143.     dc.w    $0130,$0130,$0141,$0241,$0251,$0252,$0333,$0362
  144.     dc.w    $0344,$0455,$0666,$0400,$0400,$0501,$0300,$0300
  145.  
  146. Picture    dc.l    "PCV1",0    ;Version header.
  147.     dc.l    0    ;Source data.
  148.     dc.w    336,256    ;Width, Height.
  149.     dc.w    AMT_PLANES    ;Amount of Planes.
  150.     dc.l    32    ;Amount of colours.
  151.     dc.l    Palette    ;Source palette (remap).
  152.     dc.w    LORES    ;Screen mode.
  153.     dc.w    INTERLEAVED    ;Destination
  154.     dc.l    0    ;Parameters.
  155.  
  156. PicFile:
  157.     dc.b    "GAMESLIB:data/IFF.Pic336",0
  158.     even
  159.